package ru.silviasaint.fridge.server.bean;

import java.util.Locale;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import ru.silviasaint.fridge.server.bean.impl.Substance;
@DatabaseTable
public class User extends Substance{

	@DatabaseField(canBeNull= false, unique = true)
	private String name;
	@DatabaseField(canBeNull= false)
	private String locale;

	@DatabaseField(canBeNull= false)
	private UserType type;
	@DatabaseField(canBeNull= false, unique = true)
	private String email;
	@DatabaseField(canBeNull= false)
	private String hash;
	@DatabaseField(canBeNull= false)
	private UserRole role;
	private enum UserRole{
		USER,ADMIN
	}
	private enum UserType{

	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Locale getLocale() {
		return new Locale(locale);
	}
	public void setLocale(Locale locale) {
		this.locale = locale.getCountry();
	}
	public UserType getType() {
		return type;
	}
	public void setType(UserType type) {
		this.type = type;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getHash() {
		return hash;
	}
	public void setHash(String hash) {
		this.hash = hash;
	}
	public UserRole getRole() {
		return role;
	}
	public void setRole(UserRole role) {
		this.role = role;
	}
}
